package zqkcom.atguigu.bean;

import java.io.Serializable;
import java.math.BigDecimal;

public class CartItem implements Serializable {  //购物项--》三个信息组测

    private Book book; //图书信息

    private Integer count;//买书的数量

    private Double amount;//价格

    //因为里面属性有些是不需要外部来赋值的所以是无构造器

    public Book getBook() {
        return book;
    }

    public void setBook(Book book) {
        this.book = book;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public Double getAmount() {
        BigDecimal bigDecimal1 = new BigDecimal(book.getPrice()+"");
        BigDecimal bigDecimal2 = new BigDecimal(count+"");
        BigDecimal bigDecimal = bigDecimal1.multiply(bigDecimal2);
        return bigDecimal.doubleValue();
    }

    public void setAmount(Double amount) {//金额不需要外部获取

        this.amount = amount;
    }
}
